<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
		{
			let a = 1;
			var b = 2;
		}
		console.log(b);// 2;
		console.log(a);//Uncaught ReferenceError: a is not defined(…)
		//let声明的变量只在他所在的代码块内有效
	</script>
</body>
</html>